<!doctype html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="fragment :: common_head(~{::meta},~{::title},~{},~{::style},~{})">
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        .error { border-color: red; }
    </style>
</head>
<body>
<header id="header" th:replace="fragment :: header"></header>
<div id="content">
    <h3>添加部门</h3>
    <div>
        <form action="" th:action="@{/chpt2/dept}" method="post" th:object="${department}">
            <label>部门名称:</label>
            <input type="text" th:field="*{name}" th:errorClass="error">
            <span th:each="err: ${#fields.errors('name')}" th:text="|${err}; |"></span>
            <br>
            <label>部门描述:</label>
            <textarea th:field="*{desc}" th:errorClass="error"></textarea>
            <span th:each="err: ${#fields.errors('desc')}" th:text="|${err}; |"></span>
            <br>
            <input type="submit" value="添加">
        </form>
    </div>
</div>
<footer id="footer" th:replace="fragment :: footer"></footer>
</body>
</html>